package com.example.content.client;

import androidx.appcompat.app.AppCompatActivity;

import android.content.ContentResolver;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;

public class MainActivity extends AppCompatActivity {
    private static final String TAG = "ContentProvider client";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Uri uri = Uri.parse("content://com.example.content.SPProvider/config");
        ContentResolver resolver =  getContentResolver();
        Cursor cursor = resolver.query(uri, new String[]{"_id","name"}, null, null, null);
        if (cursor != null) {
            while (cursor.moveToNext()) {
                Log.d(TAG, "query config:" + cursor.getInt(0) + " " + cursor.getString(1));
            }
            cursor.close();
        }
    }
}